<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1,minimum-scale=1, maximum-scale=1, user-scalable=no">

    <title>手机震动测试</title>
    <style>
        .shock {
            font-size: 15px;
            font-weight: bold;
            color: red;
        }
    </style>
</head>
<label>照相机</label>
<input type="file" id='image' accept="image/*" capture='camera'>
<br>
<label>摄像机</label>
<input type="file" id='video' accept="video/*" capture='camcorder'>
<body>
<div class="shock" onclick="a()">
    按我手机会震动
</div>
<script>


    function vibration() {
    navigator.vibrate = navigator.vibrate
        || navigator.webkitVibrate
        || navigator.mozVibrate
        || navigator.msVibrate;

    if (navigator.vibrate) {
        // 支持
        console.log("支持设备震动！");
    }
    $(".shock").click(function () {
        alert("1111");
        navigator.vibrate([500, 300, 400, 300]);
    });
}</script>
</body>
</html>